package com.abbas.CayTcore.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentPagerAdapter
import com.abbas.CayTcore.base.BaseFragment
import com.abbas.CayTcore.databinding.ActivityWindingBinding
import com.abbas.CayTcore.presenter.WindingActivityPresenter
import com.abbas.CayTcore.startActivity
import com.abbas.CayTcore.view.ViewContract

/**
 * 绕线主页
 */
class WindingAllDataFragment :
    BaseFragment<ViewContract.WindingActivityView, WindingActivityPresenter, ActivityWindingBinding>(),
    ViewContract.WindingActivityView {

    override fun initPresenter(): WindingActivityPresenter = WindingActivityPresenter()

    override fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): ActivityWindingBinding {
        return ActivityWindingBinding.inflate(inflater,container,false)
    }

    override fun initData() {
        presenter.getCoreData()
    }

    override fun initEvent() {
        binding.addBt.setOnClickListener {
            startActivity(AddCoreTypeActivity::class.java)
        }
    }

    override fun getAllCoreDataSuccess(adapter: FragmentPagerAdapter) {
        binding.vp.adapter = adapter
        binding.tabLayout.setupWithViewPager(binding.vp)
    }


}